package com.example.high_slope_electronic_sand_table.soilWaterContent.controller;

import com.example.high_slope_electronic_sand_table.soilWaterContent.dto.SoilWaterContentMonitorDTO;
import com.example.high_slope_electronic_sand_table.soilWaterContent.service.SoilWaterContentMonitorService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 土壤含水量监测设备接口
 */
@Tag(name = "土壤含水量监测设备接口")
@RestController
@RequestMapping(value = "/high-slope")
public class SoilWaterContentMonitorController {

    @Autowired
    private SoilWaterContentMonitorService soilWaterContentMonitorService;

    /**
     * 查询某个设备单条土壤含水量监测数据
     * @return
     */
    @Operation(summary = "查询某个设备单条土壤含水量监测数据")
    @GetMapping(value = "/soil-water/monitor/device/{deviceId}/data")
    public SoilWaterContentMonitorDTO getCurrentMonitorData(@PathVariable String deviceId){
        return soilWaterContentMonitorService.getCurrentMonitorData(deviceId);
    }

    /**
     * 查询某个设备所有土壤含水量监测数据
     * @return
     */
    @Operation(summary = "查询某个设备所有土壤含水量监测数据")
    @GetMapping(value = "/soil-water/monitor/device/{deviceId}/datas")
    public List<SoilWaterContentMonitorDTO> listMonitorDataByDeviceId(@PathVariable String deviceId){
        return soilWaterContentMonitorService.listMonitorDataByDeviceId(deviceId);
    }

    /**
     * 查询某个设备所有土壤含水量监测告警数据
     * @return
     */
    @Operation(summary = "查询某个设备所有土壤含水量监测数告警据")
    @GetMapping(value = "/soil-water/monitor/device/{deviceId}/warning/datas")
    public List<SoilWaterContentMonitorDTO> listWarningMonitorDataByDeviceId(@PathVariable String deviceId){
        return soilWaterContentMonitorService.listWarningMonitorDataByDeviceId(deviceId);
    }

    /**
     * 查询多条土壤含水量监测数据
     * @return
     */
    @Operation(summary = "查询多条土壤含水量监测数据")
    @GetMapping(value = "/soil-water/monitor/datas")
    public List<SoilWaterContentMonitorDTO> listMonitorData(){
        return soilWaterContentMonitorService.listMonitorData();
    }
}
